<template>
<el-form :model="fenceObj" status-icon ref="ruleForm" label-width="100px" class="demo-ruleForm">
  <el-form-item label="围栏标识符" prop="pass">
    <el-input  v-model="fenceObj.layerId" ></el-input>
  </el-form-item>
  <el-form-item label="围栏名称">
    <el-input  v-model="fenceObj.fenceName"></el-input>
  </el-form-item>
  <el-form-item label="备注">
    <el-input type="textarea" v-model="fenceObj.remarks"></el-input>
  </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="edit">提交</el-button>
    <el-button @click="reset">重置</el-button>
  </el-form-item>
</el-form>
</template>
<script>
export default{
  name:'EditLandMark',
  data(){
      return{
          changeMsg:Function
      }
  },
  props:{
    fenceObj:{
      type: Object,
    }
  },
  mounted() {
    // eslint-disable-next-line no-debugger
    debugger
    console.log(this.fenceObj)
  },
  methods:{
    // eslint-disable-next-line no-unused-vars
    handleClose(done) {
          this.$emit('update:dialogVisible', false);   
    },
    reset(){
      this.$emit('fatherMethod')
    },
    edit(){
      let that = this
      that.$axios.post(`http://localhost:9002/fence/edit`, {
        fenceName: that.fenceObj.fenceName,
        layerId:   that.fenceObj.layerId,
        remarks:   that.fenceObj.remarks,
      })
      .then(function (res) {
          that.$emit('fatherMethod')
          console.log(res) 
          that.$message({
              type: 'success',
              message: '修改成功'
          });   
      })
      .catch(function (error) {
          console.log(error)
          that.$message({
              type: 'info',
              message: '修改失败'
          });  
      }) 
    }
  }
}
</script>